package com.example.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.pojo.Saleinfo;
import com.example.pojo.Saleunstorage;
import com.example.service.OutStorageBiz;

@Controller
@RequestMapping("/msqout")
public class OutStorageAction {
	@Autowired
	private OutStorageBiz obiz;
	
	//历史交易记录查询
	@RequestMapping("/queryByCust")
	@ResponseBody
	public List<Saleunstorage> queryByCust(String id){
		Integer pagesize =1;
		return obiz.queryAll(pagesize);
	}
	
	//祥表信息查询
	@RequestMapping("/queryInfo")
	@ResponseBody
	public List<Saleinfo> queryInfo(String id){
		return obiz.queryInfo(id);
	}
	
	//主祥查询
	@RequestMapping("/queryAll")
	@ResponseBody
	public List<Saleunstorage> queryAll(Integer pagesize){
		return obiz.queryAll(pagesize);
	}
	
	//主祥新增
	@RequestMapping("/addorModify")
	@ResponseBody
	public void addorModify(Saleunstorage sale){
//		List<Saleinfo> data = new ArrayList<Saleinfo>();
//		data.add(new Saleinfo("13", 1, 1.0, 1.0, 1, 1.0, 1.0, 1.0, 1.0, "13", "123", "123", "123", "123", "123", "123", "123","2017052301"));
//		Saleunstorage sale = new Saleunstorage("2017052301", new Date(), "123", "123", "123", "123", "123", "123", 1.0, "123", "132", "123", "123", "123", "123", "123", 1.0, "123", "123",data);
		obiz.addorModify(sale);
	}
	
	//主祥删除
	@RequestMapping("/delete")
	@ResponseBody
	public void delete(String id){
		obiz.delete(id);
	}
	
	//修改是否审核状态
	@RequestMapping("/updateState")
	@ResponseBody
	public void updateState(String id){
		obiz.updateState(id);
	}
	
}
